/**
 * Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.work.day.service;

import java.util.List;
import java.util.Map;
import java.util.Properties;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jeeplus.modules.work.day.entity.WordBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.work.day.entity.WorkDay;
import com.jeeplus.modules.work.day.mapper.WorkDayMapper;

/**
 * 工作日配置Service
 * @author azj
 * @version 2020-04-24
 */
@Service
@Transactional(readOnly = true)
public class WorkDayService extends CrudService<WorkDayMapper, WorkDay> {
	@Autowired
	private WorkDayMapper workDayMapper;
	public WorkDay get(String id) {
		return super.get(id);
	}

	public List<WorkDay> findList(WorkDay workDay) {
		return super.findList(workDay);
	}

	public WordBean<WorkDay> findListValue(Map<String,Object> map) {
		WordBean<WorkDay> pageBean = new WordBean<>();
		PageHelper.startPage(Integer.parseInt(map.get("curPage")+""), Integer.parseInt(map.get("pageSize")+""));
		List<WorkDay> list = workDayMapper.findListValue(map);
		PageInfo<WorkDay> pageInfo=new PageInfo<>(list);
		pageBean.setCrurentNum(Integer.parseInt(map.get("curPage")+""));
		pageBean.setPageSize(Integer.parseInt(map.get("pageSize")+""));
		pageBean.setTotalNum((int) pageInfo.getTotal());
		pageBean.setTotalPageSize(pageInfo.getPages());
		pageBean.setDatas(pageInfo.getList());
		return pageBean;
	}

	@Transactional(readOnly = false)
	public void save(WorkDay workDay) {
		super.save(workDay);
	}

	@Transactional(readOnly = false)
	public void delete(WorkDay workDay) {
		super.delete(workDay);
	}

	public List<Integer> findListDate(int date,int date2){return workDayMapper.findListDate(date,date2);};

	@Transactional(readOnly = false)
	public void saveList(List<WorkDay> list) { workDayMapper.saveList(list);}

}
